{% extends "layout.html" %}
{% block content %}
    {% for post in posts.items %}
        <article class="media content-section">
            <!-- 显示作者头像 -->
            <img class="rounded-circle article-img" 
                src="{{ url_for('static', filename='profile_pics/' + post.author.image_file) }}">
            <div class="media-body">
                <div class="article-metadata">
                    <!-- 显示作者名 -->
                    <a class="mr-2" href="{{ url_for('users.user_posts', username=post.author.username) }}">
                        {{ post.author.username }}
                    </a>
                    <!-- 显示详细日期 -->
                    <small class="text-muted">
                        {{ post.date_posted.strftime('%Y-%m-%d %H:%M:%S') }}
                    </small>
                </div>
                <!-- 显示博客标题 -->
                <h2>
                    <a class="article-title" href="{{ url_for('posts.post', post_id=post.id) }}">
                    {{ post.title }}
                    </a>
                </h2>
                <!-- （关键：移除显示文章内容的代码，如 <p class="article-content">...</p>） -->
            </div>
        </article>
    {% endfor %}

    <!-- 分页逻辑 -->
    {% for page_num in posts.iter_pages(left_edge=1, right_edge=1, left_current=1, right_current=2) %}
        {% if page_num %}
            {% if posts.page == page_num %}
                <a class="btn btn-info mb-4" href="{{ url_for('main.home', page=page_num) }}">{{ page_num }}</a>
            {% else %}
                <a class="btn btn-outline-info mb-4" href="{{ url_for('main.home', page=page_num) }}">{{ page_num }}</a>
            {% endif %}
        {% else %}
            ...
        {% endif %}
    {% endfor %}
{% endblock content %}
